package com.job.landlord;

import io.jsonwebtoken.SignatureAlgorithm;
import io.jsonwebtoken.security.Keys;

import javax.crypto.SecretKey;
import java.util.Base64;

public class Main {
    public static void main(String[] args) {
        SecretKey key = Keys.secretKeyFor(SignatureAlgorithm.HS512);

        //输出生成的密钥
        System.out.println(key.getEncoded());
        //输出密钥的类型
        System.out.println(key.getAlgorithm());
        //输出密钥的长度
        System.out.println(key.getEncoded().length);
        //输出密钥的字符串表示
        System.out.println(key.toString());
        //输出密钥的Base64表示
        System.out.println(Base64.getEncoder().encodeToString(key.getEncoded()));
    }
}